﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Growl = HandyControl.Controls.Growl;

namespace AllInOne.MainPages
{
    /// <summary>
    /// SystemSetWin.xaml 的交互逻辑
    /// </summary>
    public partial class SystemSetWin : Window
    {
        public SystemSetWin()
        {
            Login login = new Login();
            login.ShowDialog();
            if (!login.DialogResult.Value) { this.Close(); }
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Control control = new Controls.SetLocal();
            SetPage.Children.Add(control);
        }

        private void SideMenuItem_Selected(object sender, RoutedEventArgs e)
        {
            string tag = (sender as HandyControl.Controls.SideMenuItem).Tag.ToString();
            Control control = null;
            switch (tag)
            {
                case "Local":
                    control = new Controls.SetLocal();
                    break;
                case "FaKaJi":
                    control = new Controls.SetFaKaJi();
                    break;
                case "Other":
                    control = new Controls.SetOther();
                    break;
            }
            if (control != null)
            {
                this.Width = 160 + control.Width;
                SetPage.Children.Clear();
                SetPage.Children.Add(control);
            }
        }

        ///// <summary>
        ///// 2023年5月29日
        ///// 解决直接退出弹框的问题
        ///// </summary>
        ///// <param name="e"></param>
        //protected override void OnClosing(CancelEventArgs e)
        //{
        //    e.Cancel = true;  // cancels the window close    
        //    this.Hide();      // Programmatically hides the window
        //}
    }
}
